Crate drm

source ·
Expand description

A safe interface to the Direct Rendering Manager subsystem found in various operating systems.

Summary

The Direct Rendering Manager (DRM) is subsystem found in various operating systems that exposes graphical functionality to userspace processes. It can be used to send data and commands to a GPU driver that implements the interface.

Userspace processes can access the DRM by opening a ‘device node’ (usually found in /dev/dri/*) and using various ioctl commands on the open file descriptor. Most processes use the libdrm library (part of the mesa project) to execute these commands. This crate takes a more direct approach, bypassing libdrm and executing the commands directly and doing minimal abstraction to keep the interface safe.

While the DRM subsystem exposes many powerful GPU interfaces, it is not recommended for rendering or GPGPU operations. There are many standards made for these use cases, and they are far more fitting for those sort of tasks.

Usage

To begin using this crate, the Device trait must be implemented. See the trait’s example section for details on how to implement it.

Modules

  • Memory management and buffer functionality that the DRM subsystem exposes.
  • Modesetting operations that the DRM subsystem exposes.

Structs

  • An authentication token, unique to the file descriptor of the device.
  • Driver version of a device.
  • Flags to alter the behaviour when waiting for a vblank
  • Data returned from a vblank wait

Enums

Constants

Traits

  • This trait should be implemented by any object that acts as a DRM device. It is a prerequisite for using any DRM functionality.